﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Brainee.Search
{
  /// <summary>
  /// Defines the interface for a search strategy implementation.
  /// </summary>
  public interface ISearchStrategy
  {
    /// <summary>
    /// Initialize the strategy internals with the specified problem.
    /// </summary>
    /// <param name="problem">The problem to solve with this strategy.</param>
    void Initialize (IProblem problem);

    /// <summary>
    /// Test if there are unexplored search states.
    /// </summary>
    /// <returns>false if there is at least one state that can be explored; otherwise, true</returns>
    bool HasUnexploredStates ();

    /// <summary>
    /// Get the next unexplored state.
    /// </summary>
    /// <returns>An unexplored search state</returns>
    ISearchState NextState ();

    /// <summary>
    /// Expands the specified state
    /// </summary>
    /// <param name="state">The state to expand</param>
    /// <param name="problem">The problem to solve</param>
    void Expand (ISearchState state, IProblem problem);
  }

  /// <summary>
  /// Specialize an ISearchStrategy with a depth limit. 
  /// </summary>
  public interface ILimitedSearchStrategy : ISearchStrategy
  {
    /// <summary>
    /// The depth limit applied to this strategy.
    /// </summary>
    UInt32 Limit { get; set; }
  }
}
